package com.example.demo.mapper;

import com.example.demo.entity.School;
import com.example.demo.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface SchoolMapper extends JpaRepository<School,String> {
    @Query(name="findSchoolByName",nativeQuery = true,value="select * from school where sname=:sname")
    School findSchoolByName(String sname);

    @Query(name="selectNameAll",nativeQuery = true,value="select sname from school")
    List<String> selectNameAll();

    @Override
    @Query(name="findAll", nativeQuery=true, value="select * from school")
    List<School> findAll ();
}
